package com.kgajowy.objects;

import edu.pjwstk.jps.datastore.IComplexObject;
import edu.pjwstk.jps.datastore.IOID;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;

public class ComplexObject extends SBAObject<Collection<IOID> > implements IComplexObject {

    private List<IOID> childs;
    
    public ComplexObject(String name, DBID id, List<IOID> childs) {
        super(name, id, childs);
        this.childs = childs;
        if ( childs == null ) {
            this.childs = new LinkedList<IOID>();
        }
    }
    
    public void add(IOID ojb){
        this.childs.add(ojb);
    }
    
    public List<IOID> getChildElements() {
        return this.childs;
    }
    
    public void addChildElement(SBAObject<Object> obj){
        this.childs.add(obj.getOID());
    }
    
    public void addChildElement(IOID obj){
        this.childs.add(obj);
    }

    @Override
    public List<IOID> getChildOIDs() {
        return this.childs;
    }

}
